package com.example.score.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeacherStarStudentMapper {

    @Insert("INSERT INTO t_teacher_student (teacher_id, student_id) VALUES (#{teacherId}, #{studentId});")
    void star(@Param("teacherId") Long teacherId, @Param("studentId") Long studentId);

    @Insert("delete from t_teacher_student where teacher_id =  #{teacherId} and student_id =  #{studentId};")
    void unStar(@Param("teacherId") Long teacherId, @Param("studentId") Long studentId);

    @Select("select student_id from t_teacher_student where teacher_id = #{teacherId}")
    List<Long> starList(@Param("teacherId") Long teacherId);
}
